<?php
$this->widget('application.extensions.fancybox.EFancyBox', array('target' => '.product', 'config' => array('width' => 800, 'height' => 520,'type'=>'iframe','hideOnOverlayClick'=>false)));
?>
<script>
var Rate = '<?=Helper::getRate()?>';
function fill(id,no,name,detail,size,weight) {
    $("#Pricing_ProductID").val(id);
	$("#Pricing_ProductModel").val(no);
	$("#Pricing_ProductName").val(name);
	$("#Pricing_ProductDetail").val(detail);
	$("#Sizecm").val(size);
	$("#WeightG").val(weight);
}
</script>
<div style="width:100%; float:left; margin-bottom:10px; text-align:right;">
<?php $form=$this->beginWidget('CActiveForm', array(
	'id'=>'pricing-form',
	'htmlOptions'=>array('name'=>'jobForm'),
	'enableAjaxValidation'=>false,
)); ?>
	<?php echo $form->errorSummary($model); ?>

	<table width="100%" border="0" cellpadding="0" cellspacing="0">
		<tr>
			<td width="20%" class="td_right"><?php echo $form->label($model,'ProductModel'); ?>: </td>
			<td width="30%">
				<?php echo $form->textField($model,'ProductModel',array('class'=>'input_size2','readonly'=>'readonly')); ?>&nbsp;&nbsp;<a class="product" href="<?=Yii::app()->createUrl('psi/productPop')?>">产品</a>
			</td>
			<td width="20%" class="td_right"><?php echo $form->label($model,'AccountingDiv'); ?>: </td>			
			<td>
				<?php echo $form->dropDownList($model,'AccountingDiv',Yii::app()->params['acct'],array('class'=>'input_size6','empty'=>array(''=>'请选择'))); ?>
			</td>
		</tr>	
		<tr>
			<td class="td_right"><?php echo $form->label($model,'ProductName'); ?>: </td>
			<td colspan="3">
				<?php echo $form->textField($model,'ProductName',array('class'=>'input_size3','readonly'=>'readonly')); ?>
			</td>
		</tr>
		<tr>
			<td class="td_right"><?php echo $form->label($model,'ProductDetail'); ?>: </td>
			<td colspan="3">
				<?php echo $form->textField($model,'ProductDetail',array('class'=>'input_size3','readonly'=>'readonly')); ?>
			</td>
		</tr>
		<tr>
			<td class="td_right"><?php echo $form->label($model,'ReceiptNo'); ?>: </td>
			<td>
				<?php echo $form->textField($model,'ReceiptNo',array('class'=>'input_size4')); ?>
			</td>
			<td class="td_right"><?php echo $form->label($model,'Status'); ?>: </td>
			<td>
				<?php echo $form->dropDownList($model,'Status',Yii::app()->params['status'],array('class'=>'input_size6')); ?>
			</td>
		</tr>
		<tr>
			<td class="td_right"><?php echo $form->label($model,'PQuantity'); ?>: </td>
			<td>
				<?php echo $form->textField($model,'PQuantity',array('class'=>'input_size4')); ?>
			</td>
			<td class="td_right"><?php echo $form->label($model,'UnitPriceRMB'); ?>: </td>		
			<td>
				<?php echo $form->textField($model,'UnitPriceRMB',array('class'=>'input_size4')); ?>
			</td>
		</tr>
		<tr>
			<td class="td_right"><?php echo $form->label($model,'ShipmentQuantity'); ?>: </td>
			<td>
				<?php echo $form->textField($model,'ShipmentQuantity',array('class'=>'disabled input_size4','disabled'=>'disabled')); ?>
			</td>
			<td class="td_right"><?php echo $form->label($model,'Balance'); ?>: </td>		
			<td>
				<?php echo $form->textField($model,'Balance',array('class'=>'disabled input_size4','disabled'=>'disabled')); ?>
			</td>
		</tr>
		<tr class="head">
			<td colspan="4">&nbsp;</td>
		</tr>
		<tr>
			<td class="td_right"><?php echo $form->label($model,'Buyer'); ?>: </td>
			<td>
				<?php echo $form->textField($model,'Buyer',array('class'=>'input_size4')); ?>
			</td>
			<td class="td_right"><?php echo $form->label($model,'PurchaseBy'); ?>: </td>		
			<td>
				<?php echo $form->dropDownList($model,'PurchaseBy',Yii::app()->params['purchase'],array('empty'=>array(''=>'请选择'),'class'=>'input_size6')); ?>
			</td>
		</tr>
		<tr>
			<td class="td_right"><?php echo $form->label($model,'ToWhom'); ?>: </td>
			<td>
				<?php echo $form->dropDownList($model,'ToWhom',Yii::app()->params['whom']); ?>
			</td>
			<td class="td_right"><?php echo $form->label($model,'Destination1'); ?>: </td>	
			<td>
				<?php echo $form->dropDownList($model,'Destination1',Yii::app()->params['des1'],array('empty'=>array(''=>'请选择'),'class'=>'input_size6')); ?>
			</td>
		</tr>
		<tr>
			<td class="td_right"><?php echo $form->label($model,'Destination2'); ?>: </td>
			<td>
				<?php echo $form->dropDownList($model,'Destination2',Yii::app()->params['des2'],array('empty'=>array(''=>'请选择'),'class'=>'input_size6')); ?>
			</td>
			<td class="td_right"><?php echo $form->label($model,'Destination3'); ?>: </td>	
			<td>
				<?php echo $form->dropDownList($model,'Destination3',Yii::app()->params['des3'],array('empty'=>array(''=>'请选择'),'class'=>'input_size6')); ?>
			</td>
		</tr>
		<tr>
			<td class="td_right"><?php echo $form->label($model,'TakePictures'); ?>: </td>
			<td>
				<?php echo $form->dropDownList($model,'TakePictures',Yii::app()->params['picture'],array('empty'=>array(''=>'请选择'),'class'=>'input_size6')); ?>
			</td>
			<td class="td_right"><?php echo $form->label($model,'InspectWay'); ?>: </td>		
			<td>
				<?php echo $form->dropDownList($model,'InspectWay',Yii::app()->params['inspect'],array('empty'=>array(''=>'请选择'),'class'=>'input_size6')); ?>	
			</td>
		</tr>
		<tr>
			<td class="td_right"><?php echo $form->label($model,'ProductLink'); ?>: </td>
			<td colspan="3">
				<?php
				echo $form->textField($model,'ProductLink',array('class'=>'input_size3'));
				if($model->ProductLink){
				?>
				<a href="http://<?=$model->ProductLink?>" target="_blank">打开</a>
				<?php
				}				
				?>
			</td>			
		</tr>
		<tr class="head">
			<td colspan="4">&nbsp;</td>
		</tr>
		<tr>
			<td class="td_right">单品尺寸_长(cm): </td>
			<td>
				<?php echo CHtml::textField('ProdPackL_cm',$model->product->ProdPackL_cm,array('class'=>'input_size4')); ?>
			</td>
			<td class="td_right">单品尺寸_宽(cm): </td>
			<td>
				<?php echo CHtml::textField('ProdPackW_cm',$model->product->ProdPackW_cm,array('class'=>'input_size4')); ?>
			</td>
		</tr>
		<tr>
			<td class="td_right">单品尺寸_高(cm): </td>
			<td>
				<?php echo CHtml::textField('ProdPackH_cm',$model->product->ProdPackH_cm,array('class'=>'input_size4')); ?>
			</td>
			<td class="td_right">单品重量(g): </td>
			<td>
				<?php echo CHtml::textField('WeightG',$model->product->WeightG,array('class'=>'input_size4')); ?>
			</td>
		</tr>
		<tr>
			<td class="td_right">整箱尺寸_长(cm): </td>
			<td>
				<?php echo CHtml::textField('BoxSizeL_cm',$model->product->BoxSizeL_cm,array('class'=>'input_size4')); ?>
			</td>
			<td class="td_right">整箱尺寸_宽(cm): </td>
			<td>
				<?php echo CHtml::textField('BoxSizeW_cm',$model->product->BoxSizeW_cm,array('class'=>'input_size4')); ?>
			</td>
		</tr>
		<tr>
			<td class="td_right">整箱尺寸_高(cm): </td>
			<td>
				<?php echo CHtml::textField('BoxSizeH_cm',$model->product->BoxSizeH_cm,array('class'=>'input_size4')); ?>
			</td>
			<td class="td_right">整箱重量(kg): </td>
			<td>
				<?php echo CHtml::textField('WeighttoCust',$model->product->WeighttoCust,array('class'=>'input_size4')); ?>
			</td>
		</tr>
		<tr>
			<td class="td_right">整箱产品数量: </td>
			<td>
				<?php echo CHtml::textField('BoxQuantity',$model->product->BoxQuantity,array('class'=>'input_size4')); ?>
			</td>
			<td class="td_right">产品展开尺寸: </td>
			<td>
				<?php echo CHtml::textField('ProductSize',$model->product->ProductSize,array('class'=>'input_size4')); ?>
			</td>
		</tr>
		<tr>
			<td class="td_right"><?php echo $form->label($model,'Inspector'); ?>: </td>
			<td>
				<?php echo $form->textField($model,'Inspector',array('class'=>'input_size4')); ?>
			</td>
			<td class="td_right"><?php echo $form->label($model,'InspectDate'); ?>: </td>		
			<td>
				<?php $this->widget('zii.widgets.jui.CJuiDatePicker', array(
						'attribute' => 'InspectDate',
						'model'=>$model,
						'language'=>'zh',
						'options' => array(
								'showAnim' => 'fold',
								'dateFormat' => 'yymmdd',
						),
						'htmlOptions'=>array(
							'readonly'=>'readonly',
							'class'=>'input_size4'
						),
				));
				?>
			</td>
		</tr>
		<tr>
			<td class="td_right"><?php echo $form->label($model,'Event'); ?>: </td>
			<td>
				<?php echo $form->dropDownList($model,'Event',Yii::app()->params['event'],array('class'=>'input_size6')); ?>
			</td>
			<td class="td_right"><?php echo $form->label($model,'ToLAMethod'); ?>: </td>
			<td>
				<?php echo $form->dropDownList($model,'ToLAMethod',Yii::app()->params['method'],array('class'=>'input_size6')); ?>
			</td>
		</tr>		
		<tr class="head">
			<td colspan="4">&nbsp;</td>
		</tr>
		<tr>
			<td class="td_right"><?php echo $form->label($model,'Note'); ?>: </td>
			<td colspan="3">
				<?php echo $form->textArea($model,'Note',array('class'=>'input_size5')); ?>
			</td>			
		</tr>	
		<tr>
			<td class="td_right"><?php echo $form->label($model,'OEFeedback'); ?>: </td>
			<td colspan="3">
				<?php echo $form->textArea($model,'OEFeedback',array('class'=>'input_size5')); ?>
			</td>			
		</tr>
		<tr>
			<td class="td_right"><?php echo $form->label($model,'OEComment'); ?>: </td>
			<td colspan="3">
				<?php
				$this->widget('application.extensions.kindeditor4.KindEditorWidget',
						array('model' => $model,'attribute' => 'OEComment',
							'htmlOptions'=>array('width' => '100%'),
							'miniMode'=>true,'editorname'=>'detail_editor'));
				?>
			</td>			
		</tr>
		<tr>
			<td colspan="4" style="text-align:center;"><?php echo CHtml::submitButton($model->isNewRecord ? '新建' : '更新'); ?></td>
		</tr>	
	</table>
	<?php echo $form->hiddenField($model,'ProductID');?> 
<?php $this->endWidget(); ?>
</div>
<?php
if($product){
?>
<script>
fill('<?=$product->ProductID?>','<?=$product->ProductModel?>','<?=$product->ProductName?>','<?=$product->ProductDetail?>');
</script>
<?php
}
?>
<?php echo $this->renderPartial('_pricing', array('model'=>$model)); ?>